<?php include_once "../../config.php" ; ?>
<?php
    //员工列表
    
    $employee_list = select_lines_all_items($table_Prefix . "employee", "nid desc", "status = '在职'", "0");
    //获取当前时间 
    $now = strtotime("now");
    //遍历员工列表数组
    foreach($employee_list as $k => $v){
        //查询是否已绑定公众号
        if($v['openid']){
            //查询该员工的超时任务
            $items = select_lines_all_items($table_Prefix."task","","status not in('待审核','已完成','已删除') and is_del = 0 and principal = ".$v['nid']." and enddate < CURDATE()","");
            //计算任务个数
            $count_items = count($items);
            //如果存在超时任务
            if($count_items){
                //获取执行人openid
                $openid = $v['openid'];
                //超时任务模板地址
                $custom_url = "https://oa.vanzetech.com/api/wechat_mp/task_timeout_model.php?openid=".$openid;
                //标题
                $tip = "您今日有".$count_items."个超时任务，请查阅";
                include ROOT_PATH_."/api/wechat_message/notice_task_changed.php" ;
            }
        }
    }
?>